package com.kingtone.rongji.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.kingtone.rongji.R;
import com.kingtone.rongji.ui.ProgressWebView;

public class BrowserFragment extends BaseFragment {

	private static final String TAG = "BrowserFragment";

	private ProgressWebView mWebView;

	private String mUrl;
	
	private String title;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		Log.i(TAG, "onCreateView");
		View view = inflater.inflate(R.layout.fragment_webview, null);
		
		initTitleView(view, title);
		
		mWebView = (ProgressWebView) view.findViewById(R.id.webview);
		mWebView.loadUrl(mUrl);
		mWebView.setWebViewClient(new WebViewClient() {
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				view.loadUrl(url.concat("&mode=1"));
				return true;
			}
		});
		return view;
	}

	public void setUrl(String url) {
		this.mUrl = url;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
}
